package cn.edu.njnu.opengmpback.resource.dao;

import cn.edu.njnu.opengmpback.resource.entity.ResourceData;
import cn.edu.njnu.opengmpback.resource.entity.UserData;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description
 * @Auther wyjq
 * @Date 2022/4/6
 **/
@Repository
public interface UserDataDao extends MongoRepository<UserData, String> {

    void deleteAllByParentId(String folderId);

    List<UserData> findAllByParentId(String parentId);

    List<UserData> findAllByUserId(String userId);

    List<UserData> findByPublicBooleanAndInitialIsTrue(boolean b, Boolean initial);

    Page<UserData> findAllByNameLikeIgnoreCaseAndProblemTagsLikeIgnoreCaseAndPublicBooleanIsTrueAndTypeIsNotAndInitialIsTrue(String searchText, String tagName, Pageable pageable, Boolean isPublic, String fileType, Boolean initial);

    Page<UserData> findAllByNameLikeIgnoreCaseAndNormalTagsLikeIgnoreCaseAndPublicBooleanIsTrueAndTypeIsNotAndInitialIsTrue(String searchText, String tagName, Pageable pageable, Boolean isPublic, String fileType, Boolean initial);

}
